# Maintainer: Maksim Bondarenkov <maksapple2306@gmail.com>

_realname=rufus
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=4.6
pkgrel=1
pkgdesc="The Reliable USB Formatting Utility (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64')
url='https://rufus.ie'
msys2_repository_url='https://github.com/pbatard/rufus'
license=('spdx:GPL-3.0-or-later')
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools"
             "${MINGW_PACKAGE_PREFIX}-cc")
source=("${msys2_repository_url}/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('4cec02a5f1400d7b5b5696fcd0eb90615d9d913f0ead2680d6d9411ee23875cf')

build() {
  mkdir -p "build-${MSYSTEM}" && cd "build-${MSYSTEM}"

  ../"${_realname}-${pkgver}"/configure \
    --prefix="${MINGW_PREFIX}" \
    --enable-silent-rules \
    --disable-debug

  make
}

package() {
  cd "build-${MSYSTEM}"

  install -Dm755 src/rufus.exe "${pkgdir}${MINGW_PREFIX}/bin/rufus.exe"
  install -Dm644 "../${_realname}-${pkgver}/LICENSE.txt" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.txt"
}
